From: Wayne Davison <wayned@samba.org>
Date: Tue, 22 Jul 2008 06:21:09 +0000 (-0700)
Subject: Explicitly cast a -1 that is being assigned to a size_t.
X-Git-Url: http://git.samba.org/?p=rsync.git;a=commitdiff_plain;h=bb640d32213c5dce2ad26515b5fc26e023ec9b98;hp=0566dc54b18fcaa6d666711ec3356bf6096af87e

Explicitly cast a -1 that is being assigned to a size_t.
---

diff --git a/flist.c b/flist.c
index 7c21f73..2d17bf7 100644
--- a/flist.c
+++ b/flist.c
@@ -689,7 +689,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
 		xbuf outbuf, inbuf;
 
 		INIT_CONST_XBUF(outbuf, thisname);
-		INIT_XBUF(inbuf, lastname, basename_len, -1);
+		INIT_XBUF(inbuf, lastname, basename_len, (size_t)-1);
 
 		if (iconvbufs(ic_recv, &inbuf, &outbuf, 0) < 0) {
 			io_error |= IOERR_GENERAL;
diff --git a/io.c b/io.c
index d884846..6068575 100644
--- a/io.c
+++ b/io.c
@@ -511,7 +511,7 @@ static void mplex_write(int fd, enum msgcode code, const char *buf, size_t len,
 		xbuf outbuf, inbuf;
 
 		INIT_XBUF(outbuf, buffer + 4, 0, sizeof buffer - 4);
-		INIT_XBUF(inbuf, (char*)buf, len, -1);
+		INIT_XBUF(inbuf, (char*)buf, len, (size_t)-1);
 
 		iconvbufs(ic_send, &inbuf, &outbuf,
 			  ICB_INCLUDE_BAD | ICB_INCLUDE_INCOMPLETE);
@@ -1093,7 +1093,7 @@ static int readfd_unbuffered(int fd, char *buf, size_t len)
 				int add_null = 0;
 
 				INIT_CONST_XBUF(outbuf, line);
-				INIT_XBUF(inbuf, ibuf, 0, -1);
+				INIT_XBUF(inbuf, ibuf, 0, (size_t)-1);
 
 				while (msg_bytes) {
 					inbuf.len = msg_bytes > sizeof ibuf
diff --git a/log.c b/log.c
index d50523b..13c9311 100644
--- a/log.c
+++ b/log.c
@@ -351,7 +351,7 @@ output_msg:
 		int ierrno;
 
 		INIT_CONST_XBUF(outbuf, convbuf);
-		INIT_XBUF(inbuf, (char*)buf, len, -1);
+		INIT_XBUF(inbuf, (char*)buf, len, (size_t)-1);
 
 		while (inbuf.len) {
 			iconvbufs(ic, &inbuf, &outbuf, 0);
diff --git a/rsync.h b/rsync.h
index 6540257..3a709d3 100644
--- a/rsync.h
+++ b/rsync.h
@@ -851,7 +851,7 @@ typedef struct {
 } xbuf;
 
 #define INIT_XBUF(xb, str, ln, sz) (xb).buf = (str), (xb).len = (ln), (xb).size = (sz), (xb).pos = 0
-#define INIT_XBUF_STRLEN(xb, str) (xb).buf = (str), (xb).len = strlen((xb).buf), (xb).size = (-1), (xb).pos = 0
+#define INIT_XBUF_STRLEN(xb, str) (xb).buf = (str), (xb).len = strlen((xb).buf), (xb).size = (size_t)-1, (xb).pos = 0
 /* This one is used to make an output xbuf based on a char[] buffer: */
 #define INIT_CONST_XBUF(xb, bf) (xb).buf = (bf), (xb).size = sizeof (bf), (xb).len = (xb).pos = 0
 
